Repository navigation
test(demo): disable git auto-maintenance in the request source sandbox - #1174
sbalabanov wants to merge 1 commit into
Conversation
sbalabanov
left a comment
There was a problem hiding this comment.
[flaky-1-f2c-reviewer] nit: two wording fixes in the commit message and PR body.
- The commit message says "automatic background maintenance (gc)". In the pinned git 2.55.0, unscheduled auto-maintenance uses the geometric strategy (
builtin/gc.c:1964-1974), so the process that writes is a geometric repack, not gc. Drop "(gc)" or say "(a repack)". The PR body already leaves it out. - "no push or commit starts a background process" (commit message) and "so nothing runs in the background while cleanup removes the directories" (PR body) claim too much. The source's own working clone (
git.go:60, created withos.MkdirTempoutsidet.TempDir) still starts auto-maintenance after its fetches and commits. That is harmless, becausecloseignores removal errors, and is why the clone is left alone. Limit the claim to the repositories you configure, for example "no push or commit into them starts one".
[flaky-1-f2c-reviewer] nit: the Test Plan's stress runs are 50, plus 50 under load. F2c's acceptance command is --runs_per_test=200 --runs_per_test_detects_flakes --nocache_test_results --local_test_jobs=32. Either run it or say why 50 is enough. Neither count can tell a fixed fixture from an unfixed one, because the natural failure rate is far too low, and the Test Plan's last sentence says so honestly. I still find the validation adequate, because the mechanism carries it:
- In 2.55.0, every auto-maintenance entry point goes through
prepare_auto_maintenance(run-command.c:1956-1967), which returns early whenmaintenance.auto=false. The entry points are commit, fetch, merge, rebase, am and receive-pack. gitexecdrops system and global config but still reads repo-local config.- Forcing the same repack in the runway git merger fixture went from failures to none once this setting was added.
For direct evidence on this fixture, run the throwaway forcing experiment and record it as a described experiment: config maintenance.geometric-repack.auto -1 on bare, --runs_per_test=20, first without the fix and then with it.
No must-fix. Every repository the file creates under t.TempDir gets maintenance.auto=false before its first command that can start maintenance. That covers each sandbox bare and seed (two of each in TestCheckFoldersHaveTargets) and that test's extra seed. For a seed, the first such command is its commit; for a bare, it is the first push into it. clone, client-side push and cat-file start no maintenance. The test style matches the surrounding lines, there are no internal names, the change touches only F2c's file, and the branch is based on current main.
The sandbox helper builds a bare repository and seed clones under t.TempDir and the code under test pushes several branches into it (TestGitSource_SerializesConcurrentChanges pushes five). A push can trigger git's automatic background maintenance, which repacks the repository and can still be writing after the test returns. TempDir cleanup then races it and can fail with 'directory not empty'. Setting maintenance.auto=false on the bare repository and on each seed clone means no push or commit in those repositories starts background maintenance, so nothing writes into them while cleanup removes them. The source's own working clone lives outside t.TempDir and is left alone. This matches tool/gitsandbox, which the helper stands in for. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
094a6d8 to
bf1edd8
Compare
sbalabanov
left a comment
There was a problem hiding this comment.
[flaky-1-f2c-reviewer] satisfied: the new comment names the race in one line, the commit message and PR body now say repack and limit the claim to the configured repositories, and the only code change since round 1 is that comment. The Test Plan nit stays a nit: the validation rests on the mechanism.
TLDR: A demo test helper could occasionally fail its temp-directory cleanup because git was still maintaining the repository in the background, so we switch that maintenance off in the helper.
Summary
The
sandboxhelper inservice/submitqueue/demo/requests/source_test.gocreates a bare repository and seed clones undert.TempDir(), and the code under test pushes branches into it (TestGitSource_SerializesConcurrentChangespushes five). A push or commit can trigger git's automatic background maintenance, which repacks the repository and can still be writing after the test returns. TempDir cleanup then races it and can fail with "directory not empty".The fix sets
maintenance.auto=falseon the bare repository and on each seed clone (insandboxand inTestCheckFoldersHaveTargets), so no push or commit in those repositories starts background maintenance while cleanup removes them. The source's own working clone lives outsidet.TempDir()and is left alone. This matchestool/gitsandbox, which the helper stands in for. Test-only change; no production code is touched.Test Plan
Run from the repository root:
./tool/bazel test //service/submitqueue/demo/requests:go_default_testpassed../tool/bazel test //service/submitqueue/demo/requests:go_default_test --runs_per_test=50 --runs_per_test_detects_flakes --nocache_test_resultspassed, 50 of 50.make lint,make check-gazelleandmake check-tidypassed.The race is host-timing dependent and was not reproduced before the fix, so the stress runs show no regression rather than a before/after delta.
🤖 Generated with Claude Code